/* -------------------------------------------------------- Declare -- */
const { $lazy } = window
/* -------------------------------------------------------- Async Component -- */
const SearchTable = $lazy.hook(()=>import('#cpt/temp/SearchTable'))
/* -------------------------------------------------------- Page Component -- */
const Component = ({ title, api }) => {
	// 编辑添加配置
	const addConfig = {
		modal: {
			title,
			width 		: '30%',
		},
		form: {
			labelWidth 	: 's2',
			data: [
				{ label: '名称', name: 'label', r:1},
			]
		}
	}
	
	const config = {
		page : {
			title: title + '管理',
			controls	: [
				{ label:'新增', mode:'add', r:1 },
				// { mode:'del', abs:1 },
				{ mode:'refresh'}
			]
		},
		// 表格配置
		table: {
			api 		: 'dict/' + api,
			addConfig,
			paging 		: 0,
			clearCache 	: 1,
			// row 		:{},
			idStr 		: 'value',
			cols		: [
				// { title: '编号', 			dataIndex: 'value' },
				{ title: '名称', 			dataIndex: 'label' }
			],
			controls 	: {
				width: 240,
				data: () => [
					{ mode:'mod', config:addConfig, abs:1 }, 
					{ mode:'delPop', abs:1 },
				]
			}
		}
	}
	return <SearchTable {...config}/>
}
export default Component